def read_mem():
    """
        解析内存信息
    """
    with open("/proc/meminfo") as mem:
        mem_dict = {}
        while True:
            data = mem.readline()
            if data:
                data = data.split(":")
                mem_dict[data[0]] = data[1].split()[0]
            else:
                break
    return mem_dict

def read_cpus():
    """
        解析处理器信息
    """
    with open("/proc/cpuinfo") as fs:
        cpu_list = []
        cpus = fs.read().rstrip().split("\n\n")
        for cpu in cpus:
            cpu_dict = {}
            for row in cpu.split("\n"):
                k,v = row.split(":")
                cpu_dict[k.rstrip().lstrip()] = str(v).rstrip().lstrip()
            cpu_list.append(cpu_dict)
    return cpu_list
